<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org" />
    <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1" />
    <meta name="GENERATOR"
    content="Mozilla/4.75 [en] (Win98; U) [Netscape]" />
    <meta name="Author" content="Mark Bixby - mark@bixby.org" />

    <title>Using Apache with HP MPE/iX</title>
    <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
  </head>

  <body text="#000000" bgcolor="#FFFFFF" link="#0000FF"
  vlink="#000080" alink="#FF0000">
    <!--#include virtual="header.html" -->

    <center>
      <h1>Using Apache With HP MPE/iX</h1>
    </center>
    This document explains how to compile, install, configure and
    run Apache 1.3 under HP MPE/iX. 

    <p>The bug reporting page and new-httpd mailing list are NOT
    provided to answer questions about configuration or running
    Apache. Before you submit a bug report or request, first
    consult this document, the <a href="misc/FAQ.html">Frequently
    Asked Questions</a> page and the other relevant documentation
    topics. If you still have a question or problem, post it to the
    <a href="news:comp.sys.hp.mpe">comp.sys.hp.mpe</a> newsgroup or
    the associated <a
    href="http://jazz.external.hp.com/papers/hp3000-info.html">HP3000-L
    mailing list</a>, where many Apache users and several
    contributors are more than willing to answer new and obscure
    questions about using Apache on MPE/iX.</p>

    <p><a
    href="http://groups.google.com/groups?hl=en&amp;lr=&amp;safe=off&amp;group=comp.sys.hp.mpe">
    groups.google.com's newsgroup archive</a> offers easy browsing
    of previous questions. Searching the newsgroup archives, you
    will usually find your question was already asked and answered
    by other users!</p>
    <hr />

    <ul>
      <li><a href="#req">Requirements</a></li>

      <li><a href="#implement">Implementation
      Considerations</a></li>

      <li><a href="#binaries">Binary Distributions</a></li>

      <li><a href="#accounting">Create the Accounting
      Structure</a></li>

      <li><a href="#down">Downloading Apache</a></li>

      <li><a href="#compile">Compiling Apache</a></li>

      <li><a href="#inst">Installing Apache</a></li>

      <li><a href="#config">Configuring Apache</a></li>

      <li><a href="#run">Running Apache</a></li>

      <li><a href="#control">Controlling Apache</a></li>
    </ul>
    <hr />

    <h2><a id="req" name="req"></a>Requirements</h2>
    Apache 1.3 requires MPE/iX 6.0 or greater.&nbsp; It will NOT
    run on earlier releases of MPE/iX.&nbsp; The following MPE/iX
    patches (or their superseding descendants) are relevant to
    Apache: 

    <ul>
      <li>MPE/iX 6.0:</li>

      <li style="list-style: none">
        <ul>
          <li>MPEKXT3B - fixes an MPE bug that results in transient
          "permission denied" errors being returned by the server
          to the browser.</li>

          <li>MPELX36A - enhances the kill() function so that MPE
          users with SM capability can send signals to Apache for
          shutdown, restart, etc.</li>

          <li>MPELX44C - fixes an MPE bug that prevents DSO modules
          from being dynamically loaded.</li>

          <li>MPELX51C - enhances the kill() function so that
          Apache can use it when the Apache parent UID is different
          from the Apache children UID (strongly recommended).</li>

          <li>NSTxxxxx - the latest network transport patch should
          always be installed when using TCP/IP applications such
          as Apache.</li>
        </ul>
      </li>

      <li>MPE/iX 6.5:</li>

      <li style="list-style: none">
        <ul>
          <li>MPELX44D - fixes an MPE bug that prevents DSO modules
          from being dynamically loaded.</li>

          <li>MPELX51D - enhances the kill() function so that
          Apache can use it when the Apache parent UID is different
          from the Apache children UID (strongly recommended).</li>

          <li>NSTxxxxx - the latest network transport patch should
          always be installed when using TCP/IP applications such
          as Apache.</li>
        </ul>
      </li>
    </ul>
    <hr width="100%" />

    <h2><a id="implement" name="implement"></a>Implementation
    Considerations</h2>
    While MPE has a very good POSIX implementation that enables
    fairly simple porting of Unix applications such as Apache,
    there are some Unix concepts which just don't exist or aren't
    fully implemented in MPE, and so this may force some
    functionality changes in the package being ported. 

    <h3>Significant MPE vs. Unix OS differences</h3>

    <ul>
      <li>MPE lacks the concept of a Unix UID=0 root user with
      special privileges.&nbsp; Where Unix functions require a user
      to be executing as root, MPE requires the user to be
      executing in priv mode, so the program file must be linked
      with PM (Priv Mode) capability, and the Unix function calls
      must be bracketed by GETPRIVMODE() and GETUSERMODE()
      calls.&nbsp; The following Unix functions used by Apache are
      affected:</li>

      <li style="list-style: none">
        <ul>
          <li>bind() for ports less than 1024</li>

          <li>setgid()</li>

          <li>setuid()</li>
        </ul>
      </li>

      <li>MPE's support for UIDs and GIDs is more limited than
      Unix.&nbsp; Every MPE account maps to a unique GID.&nbsp;
      Each MPE account can contain multiple MPE users, and every
      MPE user maps to a unique UID (UID 0 is not supported).&nbsp;
      The current UID for a process must correspond to an MPE user
      within the MPE account that corresponds to the current GID of
      the process.</li>

      <li>MPE child processes cannot survive the death of their
      parent.&nbsp; When the parent terminates, any remaining
      children will be killed.</li>

      <li>MPE doesn't initialize the envp parameter when invoking
      the main() of a new process.&nbsp; Use the global variable
      environ instead of envp.</li>

      <li>MPE link() exists, but always returns EIMPL.&nbsp; Use
      rename() or symlinks instead of hard links.</li>

      <li>MPE doesn't allow the @ character in filenames.</li>

      <li>MPE lacks support for TCP_NODELAY, but that's the default
      anyway.</li>

      <li>MPE lacks support for SO_KEEPALIVE.</li>

      <li>MPE lacks support for process groups.</li>

      <li>MPE inetd only passes stdin (and NOT stdout) to the
      invoked service.&nbsp; But you can write to stdin just
      fine.</li>
    </ul>

    <h3>Major Apache functionality issues</h3>

    <ul>
      <li>Beginning with HP-supported Apache 1.3.9 and HP WebWise
      MPE/iX Secure Web Server A.01.00 (based on Apache 1.3.9), the
      User and Group directives in httpd.conf are now
      unconditionally executed as corresponding setuid()/setgid()
      calls.&nbsp; Previously this was only done if HTTPD was being
      run as MANAGER.SYS.&nbsp; This functionality change was
      submitted back to the 1.3.13-dev source tree at
      www.apache.org.&nbsp; The Apache for Unix behavior is to only
      honor User and Group if running as root.</li>

      <li>Beginning with HP-supported Apache 1.3.9 and HP WebWise
      MPE/iX Secure Web Server A.01.00 (based on Apache 1.3.9), the
      SVIPC shared memory macros SHM_R and SHM_W have been modified
      from their traditional owner-only-read and owner-only-write
      values to be owner-and-group-read and owner-and-group-write
      on MPE/iX in order to allow increased parent/child
      flexibility in spite of MPE's limited POSIX UID/GID
      support.&nbsp; This functionality change was submitted back
      to the 1.3.13-dev source tree at www.apache.org.&nbsp; The
      Apache for Unix behavior uses the traditional owner-only
      values of SHM_R and SHM_W.</li>
    </ul>

    <h3>Minor Apache functionality issues</h3>

    <ul>
      <li>Apache for Unix must be run as root to bind to TCP ports
      1-1023. Apache for MPE must call GETPRIVMODE() to bind to TCP
      ports 1-1023; PM is not used for ports greater than 1023. The
      standard web server HTTP port is 80.</li>

      <li>Apache for Unix in standalone mode will detach itself and
      run in the background as a system-type process. Apache for
      MPE in standalone mode cannot detach itself and run in the
      background because MPE POSIX doesn't allow this (the detached
      child would be killed when the parent terminated).&nbsp;
      Therefore you must use an MPE batch job to run Apache in
      standalone mode.</li>

      <li>Apache for Unix uses process groups to manage child
      processes. Apache for MPE cannot use process groups because
      MPE POSIX doesn't support this. The implications of this are
      unknown.</li>

      <li>Apache for Unix uses the setsockopt() option TCP_NODELAY.
      Apache for MPE does not, because MPE doesn't support it. But
      TCP_NODELAY is the default MPE behavior anyway.</li>

      <li>Apache for Unix uses the setsockopt() option
      SO_KEEPALIVE.&nbsp; Apache for MPE does not, because MPE
      doesn't support it.</li>

      <li>Apache for Unix under inetd reads from the socket via
      stdin and writes via stdout. Apache for MPE under inetd reads
      *AND* writes the socket via stdin. I consider MPE 5.5 inetd
      to be broken and poorly documented, so I submitted SR
      5003355016 to address this. If HP ever alters the MPE inetd
      to pass the socket the way HPUX inetd does (not likely in the
      grand scheme of things), the existing Apache for MPE code
      will break.</li>

      <li>Apache for Unix will use the @ character in proxy cache
      filenames, but since @ is illegal in MPE filenames, Apache
      for MPE uses the % character instead.</li>
    </ul>
    <hr width="100%" />

    <h2><a id="binaries" name="binaries"></a>Binary
    Distributions</h2>
    HP ships a fully supported Apache binary distribution with the
    Fundamental Operating System (FOS) in MPE/iX 6.5 and
    later.&nbsp; This distribution can be found in the APACHE
    account. 

    <p>HP supplies fully supported Apache binary distributions for
    MPE/iX 6.0 or later available for downloading from <a
    href="http://jazz.external.hp.com/src/apache/">http://jazz.external.hp.com/src/apache/</a>.</p>

    <p>Mark Bixby supplies Apache binary distributions for MPE/iX
    available for downloading from <a
    href="http://www.bixby.org/mark/apacheix.html">http://www.bixby.org/mark/apacheix.html</a>.&nbsp;
    Binaries from bixby.org are NOT supported by HP.&nbsp; HP only
    supports binaries distributed by HP.</p>

    <p>All of the binary distributions mentioned above may possibly
    include functionality that hasn't yet been submitted back to
    the Apache Software Foundation (though submitting back is the
    intended goal).&nbsp; Please read the documentation that comes
    with these binaries in order to determine functionality
    differences (if any) compared to the latest sources available
    from the ASF.</p>

    <p>If you will be using one of these binary distributions,
    please stop reading this document and start reading the
    specific distribution documentation for installation
    details.</p>
    <hr width="100%" />

    <h2><a id="accounting" name="accounting"></a>Create the
    Accounting Structure</h2>
    Apache can be installed under the account of your choice.&nbsp;
    For the purposes of this document, the APACHE account will be
    used: 

    <ol>
      <li><tt><font size="+1">:HELLO MANAGER.SYS</font></tt></li>

      <li><tt><font size="+1">:NEWACCT APACHE,MGR</font></tt></li>

      <li><tt><font size="+1">:ALTACCT
      APACHE;PASS=xxxxxxxx;CAP=AM,AL,ND,SF,BA,IA,PM,PH</font></tt></li>

      <li><tt><font size="+1">:ALTGROUP
      PUB.APACHE;CAP=BA,IA,PM,PH;ACCESS=(R,L,X:AC;W,A,S:AL)</font></tt></li>

      <li><tt><font size="+1">:ALTUSER
      MGR.APACHE;CAP=AM,AL,ND,SF,BA,IA,PM,PH;HOME=PUB</font></tt></li>

      <li><tt><font size="+1">:NEWUSER
      SERVER.APACHE</font></tt></li>

      <li><tt><font size="+1">:ALTUSER
      SERVER.APACHE;CAP=ND,SF,BA,IA,PH;HOME=PUB</font></tt></li>
    </ol>

    <h2><a id="down" name="down"></a>Downloading Apache</h2>
    Use your web browser to download the Apache source tarball from
    <a
    href="http://www.apache.org/dist/httpd/">http://www.apache.org/dist/httpd/</a>.&nbsp;
    Then ftp upload the tarball to your e3000 as show below: 
<pre>
C:\Temp&gt;ftp 3000.host.name
Connected to 3000.host.name.
220 HP ARPA FTP Server [A0009H09] (C) Hewlett-Packard Co. 1990
User (3000.host.name:(none)): MGR.APACHE
331 Password required for MGR.APACHE.  Syntax: acctpass
Password:xxxxxxxx
230 User logged on
ftp&gt; quote type L 8
200 Type set to L (byte size 8).
ftp&gt; put apache_v.u.ff.tar.Z /tmp/apache.tar.Z
200 PORT command ok.
150 File: /tmp/apache.tar.Z opened; data connection will be opened
226 Transfer complete.
ftp: 2685572 bytes sent in 2.75Seconds 976.57Kbytes/sec.
ftp&gt; quit
221 Server is closing command connection
</pre>
    Unpack the tarball: 

    <ol>
      <li><tt>:HELLO MGR.APACHE</tt></li>

      <li><tt>:XEQ SH.HPBIN.SYS -L</tt></li>

      <li><tt>$ mkdir src</tt></li>

      <li><tt>$ chmod 700 src</tt></li>

      <li><tt>$ cd src</tt></li>

      <li><tt>$ tar xvfopz /tmp/apache.tar.Z</tt></li>
    </ol>

    <h2><a id="compile" name="compile"></a>Compiling Apache</h2>
    It is STRONGLY recommended to use gcc instead of the HP C/iX
    compiler.&nbsp; You can obtain gcc from <a
    href="http://jazz.external.hp.com/src/gnu/gnuframe.html">http://jazz.external.hp.com/src/gnu/gnuframe.html</a>.
    

    <ol>
      <li><tt>$ cd apache_v.uu.ff</tt></li>

      <li><tt>$ ./configure --prefix=/APACHE/PUB
      --enable-module=xxx --enable-module=yyy ...etc...</tt></li>

      <li><tt>$ make</tt></li>
    </ol>

    <h2><a id="inst" name="inst"></a>Installing Apache</h2>

    <ol>
      <li><tt>$ make install</tt></li>

      <li><tt>$ cd /APACHE/PUB</tt></li>

      <li><tt>$ mv bin/httpd HTTPD</tt></li>

      <li><tt>$ ln -s HTTPD bin/httpd</tt></li>

      <li><tt>$ callci "xeq linkedit.pub.sys 'altprog
      HTTPD;cap=ia,ba,ph,pm'"</tt></li>
    </ol>

    <h2><a id="config" name="config"></a>Configuring Apache</h2>
    Edit /APACHE/PUB/conf/httpd.conf and customize as needed for
    your environment.&nbsp; Be sure to make the following mandatory
    changes: 

    <ul>
      <li>User SERVER.APACHE</li>

      <li>Group APACHE</li>
    </ul>

    <h2><a id="run" name="run"></a>Running Apache</h2>
    Simply create and :STREAM the following standalone server job
    in order to start Apache: 
<pre>
!JOB JHTTPD,MGR.APACHE;OUTCLASS=,2
!XEQ SH.HPBIN.SYS "-c 'umask 007; ./HTTPD -f /APACHE/PUB/conf/httpd.conf'"
!eoj
</pre>

    <h2><a id="control" name="control"></a>Controlling Apache</h2>
    Log on as MGR.APACHE (or MANAGER.SYS or any other SM user if
    you've installed MPELX36A on 6.0) in order to shutdown or
    restart Apache via the use of signals. 

    <p>To shut down Apache from the POSIX shell:</p>
<pre>
$ kill `cat /APACHE/PUB/logs/httpd.pid`
</pre>
    To shut down Apache from the CI: 
<pre>
:XEQ SH.HPBIN.SYS '-c "kill `cat /APACHE/PUB/logs/httpd.pid`"'
</pre>
    <!--#include virtual="footer.html" -->
  </body>
</html>

